package com.irdstudio.smcenter.agent.boot;

import java.sql.SQLException;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

import com.irdstudio.smcenter.agent.utils.SpringContextUtils;
import com.irdstudio.smcenter.core.init.AgentResourceLoader;

/**
 * <p>Agent启动入口,按local模式启动</p>
 * @author ligm
 */
@SpringBootApplication
@ComponentScan(basePackages = {"com.irdstudio.smcenter.agent"})
public class DubboAgentBoot {

	public static void main(String[] args) throws SQLException {

		// 读取配置文件中的配置
		AgentResourceLoader.me().start();
		
		// 以dubbo模式启动Agent
		System.out.println("正在以agent for dubbo模式启动...");
		ApplicationContext context = SpringApplication.run(DubboAgentBoot.class, args);
		SpringContextUtils.setApplicationContext(context);
	}
}
